﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;

/// <summary>
///row 的摘要说明
/// </summary>
[Serializable]
public class row
{
    private string id;
    private string ct;
    private string filename;
    private string numDisFirst;//第一个要显示的web的序号.  **NumDisFirst=5表示从第5个web开始显示**
    private List<web> m_rowwebs;

    public string Id
    {
        set
        {
            id = value;
        }
        get
        {
            return id;
        }
    }

    public string Ct
    {
        set
        {
            ct = value;
        }
        get
        {
            return ct;
        }
    }

    public string Filename
    {
        get
        {
            return filename;
        }
        set
        {
            filename = value;
        }
    }

    public string NumDisFirst //第一个要显示的web的序号.  **NumDisFirst=5表示从第5个web开始显示**
    {
        get
        {
            return numDisFirst;
        }
        set
        {
            numDisFirst = value;
        }
    }

    public List<web> Mrowwebs
    {
        set
        {
            m_rowwebs = value;
        }
        get
        {
            return m_rowwebs;
        }
    }

    public web this[int i]
    {
        get
        {
            return this.m_rowwebs[i];
        }
        set
        {
            this.m_rowwebs[i] = value;
        }
    }

    public web getWebByID(string _paraID)
    {
        for (int i = 0; i < this.m_rowwebs.Count; i++)
        {
            if (_paraID == this.m_rowwebs[i].ID)
            {
                return m_rowwebs[i];
            }
        }
        return null;
    }

    public bool removeWeb(web _paraWeb)
    {
        try
        {
            m_rowwebs.Remove(_paraWeb);
            return true;
        }
        catch (Exception ex)
        {
            return false;
        }

    }

    //public static string operator [](int i)
    //{
    //    return m_web[i];
    //}
    public row()
    {

    }

	public row(XElement xe)// xe = XElement.Parse("<row><ID>1</ID><ct>video</ct><web>.......<web></row>");
	{
        id = xe.Element("ID").Value;
        ct = xe.Element("ct").Value;
        int max = xe.Elements("web").Count();
        if (xe.Element("nDF") == null)
        {
            numDisFirst = "0";
        }
        else
        {
            numDisFirst = xe.Element("nDF").Value;
        }
	}

    public row(string _id, string _ct,string _numDisFirst)
    {
        id = _id;
        ct = _ct;
        numDisFirst = _numDisFirst;
    }
}
